package com.dongdongshop.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbOrderItemMapper;
import com.dongdongshop.pojo.order.TbOrderItem;
import com.dongdongshop.service.OrderItemServiceI;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Service
public class OrderItemServiceImpl implements OrderItemServiceI {

    @Resource
    private TbOrderItemMapper orderItemMapper;


    @Override
    public Long selectItemById(long id) {
        return orderItemMapper.selectItemById(id);
    }

    @Override
    public void updateStatusById(long id) {
        TbOrderItem orderItem = new TbOrderItem();
        orderItem.setId(id);
        orderItem.setStauts("5");
        orderItemMapper.updateByPrimaryKeySelective(orderItem);
    }

    @Override
    public TbOrderItem selectOrderItemById(long id) {
        return orderItemMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<TbOrderItem> selectByOrderId(Long orderId) {
        return orderItemMapper.selectByOrderId(orderId);
    }
}
